<template>
	<view class="box">
		<view class="top">
			<view class="topbox">
				<view class="left">
					<span>可使用余额(元)</span>
					<p>{{ass.amount}}</p>
				</view>
				<view class="right">
					<button @click="tixian">提现</button>
				</view>
			</view>
			<view class="zongjie">
				<view class="left">
					<span>总计收益</span>
					<p>{{ass.totalIncome}}</p>
				</view>
				<view class="con">
					<span>已提现金额</span>
					<p>{{ass.totalCashOut}}</p>
				</view>
				<view class="right">
					<span>支付抵扣金额</span>
					<p>{{ass.totalRedeem}}</p>
				</view>
			</view>
		</view>
		<view class="tabbox">
			<view class="left" :class="huan == 1?'beijingse':''" @click="mingxi(1)">
				收入明细
			</view>
			<view class="right" :class="huan == 0?'beijingses':''" @click="mingxi(0)">
				支出明细
			</view>
		</view>
		<view class="neirboxs" >
			<view v-show="huan == 1" class="hezi" v-for="(item,index) in list" :key="index">
				<view class="hezi_top">
					<view class="left">
						收益日期:{{item.createTime}}
					</view>
					<view class="right">
						{{item.orderChannel}}
					</view>
				</view>
				<view class="hezi_con">
					<view>
						<span>{{item.orderProductCount}}</span>
						<p>下单数量</p>
					</view>
					<view>
						<span>{{item.orderTotalAmount}}</span>
						<p>下单金额(￥)</p>
					</view>
					<view>
						<span>{{item.amount}}</span>
						<p>收益金额(￥)</p>
					</view>
				</view>
				<view class="xinxi">
					<view class="left">
						下单门店:{{item.shopName}}
					</view>
					<view class="right">
						联系人:{{item.shopUserName}}{{item.shopUserPhone}}
					</view>
				</view>
			</view>
			
			<view v-show="huan == 0"  class="zhichuhezi">
				<view class="zhichu_box" v-for="(item,index) in list" :key="index">
					<view class="left">
						<span>{{item.consumeType}}</span>
						<p>{{item.createTime}}</p>
					</view>
					<view class="right">
						<span>-{{item.amount}}</span>
					</view>
				</view>
			</view>
		</view>
		<view class="kongs" v-show="shuju">
			<image class="img" src="../../static/tabbar/kong.png" mode=""></image>
			<view class="text">
				暂无数据
			</view>
		</view>
		
		
	</view>
</template>

<script>
	import {
		flowwallet,
		walletlist
	} from '../../common/http.api.js'
	export default {
		data() {
			return {
				huan: 1,
				ass: {},
				shuju: true,
				qwe: {
					flowType: 1
				},
				list:[]
			}
		},
		onLoad() {
			this.gitlist()
			this.getlist()
		},
		methods: {
			gitlist() {
				let arr = {}
				flowwallet(arr).then(res => {
					this.ass = res.data
				})
			},
			getlist() {
				walletlist(this.qwe).then(res => {
					this.list = res.rows
					if (res.rows.length == 0) {
						this.shuju = true
					} else {
						this.shuju = false
					}
					this.list.forEach((item) => {
						if (item.orderChannel == 0) {
							item.orderChannel = '平台下单'
						} else {
							item.orderChannel = '自主下单'
						}
						if (item.consumeType == 1) {
							item.consumeType = '提现'
						} else {
							item.consumeType = '下单抵扣'
						}
					})
				})
			},
			mingxi(index) {
				this.huan = index
				this.qwe.flowType = index
				this.getlist()
			},
			tixian() {
				uni.navigateTo({
					url: '/pages/geren/tixian'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.kongs{
		margin-top: 80rpx;
		.img{
			width: 300rpx;
			height: 300rpx;
		}
		.text{
			color: #CCCCCC;
			text-align: center;
		}
	}
	.neirboxs {
		padding-bottom: 50rpx;
	}

	.zhichuhezi {
		width: 700rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		.zhichu_box {
			margin-top: 10rpx;
			width: 92%;
			padding: 20rpx;
			border-bottom: 1px solid #eeeeee;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.left {
				span {
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #333333;
				}

				p {
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 23rpx;
					color: #999999;
					margin-top: 10rpx;
				}
			}

			.right {
				span {
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 30rpx;
					color: #333333;
				}

				p {
					padding: 10rpx;
					background-color: #24170e;
					border-radius: 10rpx;
					color: #C18F36;
					font-size: 20rpx;
					margin-top: 10rpx;
				}
			}
		}
	}

	.hezi {
		width: 660rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 20rpx;
		margin-top: 30rpx;

		.xinxi {
			width: 616rpx;
			background: #FAF5E9;
			border-radius: 10rpx;
			margin-top: 20rpx;
			padding: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.left {
				font-family: PingFang SC;
				font-weight: 800;
				font-size: 23rpx;
				color: #BC7E13;
				line-height: 33rpx;
			}

			.right {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 23rpx;
				color: #BC7E13;
				line-height: 33rpx;
			}
		}

		.hezi_con {
			padding-left: 10rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 20rpx;

			span {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 28rpx;
				color: #141414;
			}

			p {
				margin-top: 5rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 22rpx;
				color: #777777;
			}
		}

		.hezi_top {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 10rpx 10rpx;
			border-bottom: 1px solid #eeeeee;
			padding-bottom: 30rpx;

			.left {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 22rpx;
				color: #999999;
			}

			.right {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 22rpx;
				color: #C18F36;
			}
		}
	}

	.beijingse {
		background-color: #41301B;
		color: #FFEFDB !important;
		border-radius: 14rpx 0rpx 0rpx 14rpx;
	}

	.beijingses {
		background-color: #41301B;
		color: #FFEFDB !important;
		border-radius: 0rpx 14rpx 14rpx 0rpx;
	}

	.tabbox {
		width: 434rpx;
		height: 59rpx;
		background: #FFFFFF;
		border-radius: 14rpx;
		border: 1px solid #41301B;
		margin-top: 60rpx;
		display: flex;

		view {
			width: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #41301B;
		}
	}

	.top {
		background-image: linear-gradient(90deg, #24170e 0%, #47351e 100%);
		width: 660rpx;
		// height: 311rpx;
		border-radius: 10rpx;
		margin-top: 20rpx;
		padding: 20rpx;

		.zongjie {
			background-image: linear-gradient(90deg, #fdedd2 0%, #f3d7a6 100%);
			width: 623rpx;
			border-radius: 10rpx;
			margin-top: 10rpx;
			padding: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			view {
				display: flex;
				flex-direction: column;
				align-items: center;

				p {
					font-family: PingFang SC;
					font-weight: 800;
					font-size: 34rpx;
					color: #743A00;
					margin-top: 18rpx;
				}

				span {
					font-family: PingFang SC;
					font-weight: 400;
					font-size: 23rpx;
					color: #743A00;
				}
			}
		}

		.topbox {
			display: flex;
			justify-content: space-between;
			align-items: center;



			.right {
				button {
					width: 150rpx;
					height: 56rpx;
					background: linear-gradient(0deg, #F2D099 0%, #F5E1BD 100%);
					border-radius: 28rpx;
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 25rpx;
					color: #884400;
				}
			}

			.left {
				margin-left: 30rpx;

				span {
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #FFDDAC;
				}

				p {
					margin-top: 30rpx;
					font-family: PingFang SC;
					font-weight: 800;
					font-size: 58rpx;
					color: #FFDDAC;
				}
			}
		}
	}
</style>